package com.eling.elcms.travel.model;

import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.hibernate.OrderCriteriaEnhancer;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.system.model.CommonUser;
import com.eling.elcms.travel.model.CheckInImplement.CheckStatus;
import org.hibernate.search.annotations.*;

import javax.persistence.*;
import java.util.Date;

/**
 * 入住派车处理
 * @author wulina
 */
@Entity
@Table(name = "travel_checkincar")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = {
		@CriteriaEnhancer(impl = OrderCriteriaEnhancer.class) })
public class CheckInCar extends BaseModel{

	private static final long serialVersionUID = -8759869532363470136L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkCheckInCar;
	
	/** 入住准备落实 */
	@ManyToOne(fetch = FetchType.LAZY)//, mappedBy = "checkInCar")
	@JoinColumn(name = "pkCIImplement")
	@IndexedEmbedded(depth = 1)
	private CheckInImplement checkInImplement;
	
	/** 是否派车 */
	@Column
	private Boolean haveCar;
	
	/** 地址 */
	@Column
	@Field
	private String address;
	
	/** 时间 */
	@Column
	@Field
	@Between
	private Date carDate;
	
	/** 公司名称 */
	@Column
	@Field
	private String corpName;
	
	/** 司机名称 */
	@Column
	@Field
	private String driverName;
	
	/** 司机电话 */
	@Column
	@Field
	private String driverPhone;
	
	/** 备注 */
    @Column(length = 1023)
	private String description;	
    
	/** 处理人 */
    @ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "operator")
	@IndexedEmbedded(depth = 1)
	private CommonUser operator;
	
	/** 处理时间 */
    @Column
	private Date operateDate;   
    
    /** 状态	无要求，待落实，已落实 */
    @Enumerated(EnumType.STRING)
    @Field
    @FieldBridge(impl = EnumBridge.class)
    private CheckStatus status;
    
    @Version
    private Integer version;

	public Long getPkCheckInCar() {
		return pkCheckInCar;
	}

	public void setPkCheckInCar(Long pkCheckInCar) {
		this.pkCheckInCar = pkCheckInCar;
	}

	public CheckInImplement getCheckInImplement() {
		return checkInImplement;
	}

	public void setCheckInImplement(CheckInImplement checkInImplement) {
		this.checkInImplement = checkInImplement;
	}

	public Boolean getHaveCar() {
		return haveCar;
	}

	public void setHaveCar(Boolean haveCar) {
		this.haveCar = haveCar;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getCarDate() {
		return carDate;
	}

	public void setCarDate(Date carDate) {
		this.carDate = carDate;
	}

	public String getCorpName() {
		return corpName;
	}

	public void setCorpName(String corpName) {
		this.corpName = corpName;
	}

	public String getDriverName() {
		return driverName;
	}

	public void setDriverName(String driverName) {
		this.driverName = driverName;
	}

	public String getDriverPhone() {
		return driverPhone;
	}

	public void setDriverPhone(String driverPhone) {
		this.driverPhone = driverPhone;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public CommonUser getOperator() {
		return operator;
	}

	public void setOperator(CommonUser operator) {
		this.operator = operator;
	}

	public Date getOperateDate() {
		return operateDate;
	}

	public void setOperateDate(Date operateDate) {
		this.operateDate = operateDate;
	}

	public CheckStatus getStatus() {
		return status;
	}

	public void setStatus(CheckStatus status) {
		this.status = status;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
